package com.bocai.eelly.common;

import android.content.Intent;
import android.os.Bundle;

import com.bocai.eelly.R;
import com.bocai.eelly.event.MainEvent;
import com.bocai.eelly.net.Api;
import com.bocai.eelly.net.MyRetrofit;
import com.trello.rxlifecycle.components.support.RxFragment;

import de.greenrobot.event.EventBus;


/**
 * Created by kaizen on 16/4/8.
 */
public class BaseFragment extends RxFragment {


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EventBus.getDefault().register(this);
    }

    @Override
    public void startActivity(Intent intent) {
        super.startActivity(intent);
        getActivity().overridePendingTransition(R.anim.slide_right_in, R.anim.slide_remain);
    }

    public Api getTestApi(){
        return new MyRetrofit().getGirlApi();
    }

    /**
     * 在主线程运行
     * @param event
     */
    public void onEventMainThread(MainEvent event) {
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        EventBus.getDefault().unregister(this);
    }
}
